<?php
	require_once 'header.php';
	require_once 'OwnerPage.php';
	require_once 'backend/Employees.php';
	require_once 'backend/Owner.php';
	$Owner = new Owner();
?>

		<form action="ManageEMP.php" method="post">
		<fieldset>
		<legend>Employee LIST</legend>
		<?php
			echo $Owner->GetAllEmployee();
			if(isset($_POST['ConfirmSalaryChange']))
			{
				$newSal = $_POST['New-Salary'];
				$emp = $_POST['EMP'];
				$Owner->updateEMPSalary($emp,$newSal);
				?>
				<script language="JavaScript">window.location.href="ManageEMP.php"</script>
				<?php
			}
			if(isset($_POST['Fired']))
			{
				$emp = $_POST['EMP'];
				$Owner->FiredEMP($emp);
				?>
				<script language="JavaScript">window.location.href="ManageEMP.php"</script>
				<?php
			}
		?>
		Salary-Change: <input type="text" name="New-Salary" value="New-Salary"/>
		<input type="submit" name="ConfirmSalaryChange" value="ConfirmSalaryChange"/>
		<input type="submit" name="Fired" value="Fired"/>
		</fieldset>
		<fieldset>
		<legend>New Employee</legend>
		<?php 
			if(isset($_POST['Confirm']))
			{
				$name = $_POST['Name'];
				$pass = $_POST['Pass'];
				$sal = $_POST['Salary'];
				$Owner->HiredEMP($name,$pass,$sal);
				?>
				<script language="JavaScript">window.location.href="ManageEMP.php"</script>
				<?php
			}
		?>
		<p>
		Name: <input type="text" name="Name" value="Name"/>
		Password: <input type="password" name="Pass" value="Password"/><br>
		Salary: <input type="text" name="Salary" value="Started-Salary"/>$(per Month)
		<p>
		<input type="submit" name="Confirm" value="Create Employee"/>
		<input type="reset" name="Clear" value="Clear">
		</p>
		</p>
		</fieldset>
		</form>
	</div>
	
	<?php require_once 'footer.php';?>